#!/bin/bash

set -x

#if first argument is the empty string, testall
if [ -z $1 ]
then  ctlist="0 1 3"
else  ctlist=$1
fi


for cttype in $ctlist
do
    echo "testing characteristic type $cttype"

#pgm images
    for imgname in lenna barbara testscreensmallgrey 
    do
	imggenccd -ct $cttype ../images/$imgname.pgm temp/temp
	diff temp/temp.cc goodcc/$imgname${cttype}.cc
    done
	
#ppm images
    for imgname in testscreensmall
    do
	imggenccd -ct $cttype ../images/$imgname.ppm temp/temp
	diff temp/temp.cc goodcc/$imgname${cttype}.cc
    done
done
	
#additional lennatest
if [ -n $2 ]
then
    imgname="lenna"
    for cttype in $2
    do
	imggenccd -ct $cttype ../images/$imgname.pgm temp/temp
	diff temp/temp.cc goodcc/$imgname${cttype}.cc
    done
fi